package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 获取商品评论标签请求类
 *
 * @author hongyuhao
 * @version 2014年3月15日 - 上午9:58:28
 */
public class TagGoodsRelationListRequest extends Request {

	private static final long serialVersionUID = -9202410285833153238L;
	
	private int goodsId;

	/**套餐id*/
	private Integer mealId;
	
	private int pageNum;
	private int pageSize;
	
	public int getGoodsId() {
		return goodsId;
	}


	public void setGoodsId(int goodsId) {
		this.goodsId = goodsId;
	}

	public Integer getMealId() {
		return mealId;
	}

	public void setMealId(Integer mealId) {
		this.mealId = mealId;
	}
	
	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	

	@Override
	public void parse(HttpServletRequest request) {
		
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.goodsId = requestInfo.getIntParameter(ApiUrlParamEnum.goodsId.getParamName(), -1);

		this.mealId = requestInfo.getIntParameter(ApiUrlParamEnum.mealId.getParamName(), 0);
		if ( goodsId < 1 && mealId < 1) {
			throw new RequestIllegalException("缺少商品id或套餐id");
		}
		
		this.pageNum = requestInfo.getIntParameter(ApiUrlParamEnum.pageNo.getParamName(), 1);
		this.pageSize = requestInfo.getIntParameter(ApiUrlParamEnum.pageSize.getParamName(), 20);
	}
	
}
